// 接口类型定义(使用命名空间)

/**
 * 后端约定响应数据格式
 */
export interface IResponseData<T = any> {
    code: number | string;
    msg: string;
    data: T;
}

/**分页数据定义
 */
export interface IListData<T = any> {
    list: T[];
    page: {
        pageNum: number;
        pageSize: number;
        total: number | 0;
    };
}

/**分页公用参数定义
 */
export interface IPageParams {
    pageNum: number;
    pageSize?: number;
}

/**
 * 登录接口参数类型
 */
export namespace ILogin {
    export interface Params {
        username: string;
        password: string;
    }
}

/**
 * 首页模块接口参数类型
 */
export namespace IDashboard {
    export interface ReportData {
        driverCount: number;
        totalMoney: number;
        orderCount: number;
        cityNum: number;
    }
    export interface LineData {
        label: string[];
        order: number[];
        money: number[];
    }
    export interface PieData {
        value: number;
        name: string;
    }
    export interface RadarData {
        indicator: Array<{ name: string; max: number }>;
        data: {
            name: string;
            value: number[];
        };
    }
}
/**
 * 用户模块接口参数类型
 */
export namespace IUser {
    export interface UserItem {
        createId: string;
        createTime: string;
        deptId: string;
        deptName: string;
        gender: string;
        job: string;
        lastLoginTime: string;
        mobile: string;
        roleList: string[];
        state: string;
        userEmail: string;
        userId: string;
        userImg: string;
        userName: string;
    }
    export interface Params extends IPageParams {
        userId?: string;
        userName?: string;
        state?: string;
    }
    export interface SearchParams {
        userId?: string;
        userName?: string;
        state?: string;
    }
    export interface CreateParams {
        deptId: string;
        gender: string;
        job?: string;
        mobile?: string;
        roleList?: string[];
        state?: string;
        userEmail: string;
        userImg: string;
        userName: string;
    }
    export interface EditParams extends CreateParams {
        userId: string;
    }
    export interface DelParams {
        userId: string;
    }
}

/**
 * 菜单模块接口参数类型
 */
export namespace IMenu {
    export interface MenuItem {
        buttons?: MenuItem[];
        children?: MenuItem[];
        createId: string;
        createTime: string;
        icon: string;
        menuId: string;
        menuName: string;
        // 1：正常 2：停用
        menuState: string;
        // 1: 菜单 2：按钮 3：页面
        menuType: string;
        menuCode: string;
        orderBy: number;
        parentId: string;
        path: string;
        updateTime: string;
    }
    export interface Params {
        menuName?: string;
        menuState?: string;
    }
    export interface CreateParams {
        icon?: string;
        menuName: string;
        menuState: string;
        menuType: string;
        menuCode?: string;
        parentId?: string;
        path?: string;
    }
    export interface EditParams extends CreateParams {
        menuId: string;
    }
    export interface DelParams {
        menuId: string;
    }
}

/**
 * 角色模块接口参数类型
 */
export namespace IRole {
    export interface RoleItem {
        roleId: string;
        roleName: string;
        remark: string;
        permissionList: {
            checkedKeys: string[];
            halfCheckedKeys: string[];
        };
        updateTime: string;
        createTime: string;
    }
    export interface Params extends IPageParams {
        roleName?: string;
    }
    export interface SearchParams {
        roleName?: string;
    }
    export interface CreateParams {
        roleName: string;
        remark?: string;
    }
    export interface EditParams extends CreateParams {
        roleId: string;
    }
    export interface DelParams {
        roleId: string;
    }
    export interface Permission {
        roleId: string;
        permissionList: {
            checkedKeys: string[];
            halfCheckedKeys: string[];
        };
    }
}

/**
 * 部门模块接口参数类型
 */
export namespace IDept {
    export interface DeptItem {
        children: DeptItem[];
        createTime: string;
        createId: string;
        deptId: string;
        deptName: string;
        parentId: string;
        updateTime: string;
        userId: string;
        userName: string;
    }
    export interface Params {
        deptName?: string;
    }
    export interface CreateParams {
        deptName: string;
        parentId?: string;
        userId: string;
    }
    export interface EditParams extends CreateParams {
        deptId: string;
    }
    export interface DelParams {
        deptId: string;
    }
}
